<template>
  <div class="project-desc container">
    <wj-title :title="this.$route.params.title.split('.')[0]"/>
    <div v-html="htmlMD" v-highlight></div>
  </div>
</template>

<script>
  import wjTitle from "@/components/wj-title";
  import {scrollAnimation} from "@/utils/scroll";
  import "highlight.js/styles/atelier-forest-dark.css";
  import {getDocumentDesc} from "@/network/all.request";
  import * as folderTypes from "@/common/folder-type";
  const marked = require('marked');

  export default {
    name: "projectDesc",
    data() {
      return {
        htmlMD: ""
      }
    },
    components: {
      wjTitle
    },
    created() {
      scrollAnimation(window.scrollY, 0);
    },
    mounted() {
      const title = this.$route.params.title;
      getDocumentDesc(folderTypes.PROJECT, title).then(res => {
        this.htmlMD = marked(res);
      }).catch(console.log)
    }
  }
</script>

<style scoped>
  .project-desc {
    margin-top: 62px;
    min-height: 100vh;
    padding-top: 25px;
  }
</style>